<template>
	<view style="height: 100vh; background-color: #FFFFFF;">
		<u-navbar title-color="#FFFFFF" height="48" back-icon-color="#FFFFFF" :border-bottom="false" :is-fixed="true"
			:title="'延期审核'"></u-navbar>
		<view>
			<u-form :model="form" ref="form" label-width="100px" style="padding: 24rpx;">
				<u-form-item label-position="left" label="设置整改期限" prop="fireAuditTimeStr">
					<u-input type="text" :border="border" placeholder="选择整改期限" v-model="form.fireAuditTimeStr"
						:disabled="true" @click="show =true" />
				</u-form-item>
				<u-form-item label-position="left" label="审核意见" prop="fireAuditOpinion">
					<u-input type="text" :border="border" placeholder="请输入审核意见" v-model="form.fireAuditOpinion" />
				</u-form-item>
			</u-form>
			<u-picker v-model="show" mode="time" :params="params" @confirm="confirmEnd"></u-picker>
		</view>
		<u-button @click="submit" type="primary" style="margin: 24rpx;">确认</u-button>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				show: false,
				mode: 'range',
				border: true,
				params: {
					year: true,
					month: true,
					day: true,
					hour: true,
					minute: true,
					second: true
				},
				form: {
					ucId: null,
					fireAuditTimeStr: null,
					fireAuditTime: null,
					fireAuditOpinion: null
				},
				rules: {
					fireAuditTimeStr: [{
						required: true,
						message: '选择整改期限',
						trigger: ['change', 'blur'],
					}],
					fireAuditOpinion: [{
						required: true,
						message: '请输入审核意见',
						trigger: ['change', 'blur'],
					}]
				}
			}
		},
		methods: {
			onLoad(e) {
				this.form.ucId = e.ucId
			},
			back() {
				window.native.back()
			},
			submit() {
				this.$refs.form.validate(valid => {
					if (valid) {
						this.utils.request("/api/app/inHiddenDanger/hiddenDangerContinueToRectify", this.form,
							"post","app", true).then(res => {
							uni.navigateTo({
								url: '/pages/index/firedanger/index'
							})
						}).catch(error => {
							console.log(error)
						})
					}
				});
			},
			confirmEnd(e) {
				this.form.fireAuditTimeStr = e.year + '-' + e.month + '-' + e.day + ' ' + e.hour + ':' + e.minute +
					':' + e.second;
				this.form.fireAuditTime = new Date(this.form.fireAuditTimeStr)
			}
		},
		onReady() {
			this.$refs.form.setRules(this.rules);
		},
	}
</script>